"""
Interfaces used in the tickets package
"""

from zope import interface

class ITicketSystem(interface.Interface):
    """
    Basic functionality required for the Boardroom
    Ticket System integration.
    """
    status_codes = interface.Attribute("""a dictionary of status codes and their descriptions""")

    def addComment(ticketID, comment):
        """Adds comment to ticket identified by ticketID"""

    def createTicket(ticketDict):
        """Creates a new ticket in the TicketSystem using the fields
        of ticketDict.

        Required and optional fields are determined by the TicketSystem"""

    def getComments(ticketID):
        """Returns comments associated with ticketID"""

    def getTicket(ticketID):
        """Returns a dictionary containing the
        information associated with ticketID"""

    def updateTicket(ticketID, ticketDict):
        """Updates fields of the ticket identified by ticketID
        with key:value pairs from ticketDict"""

    def getStatus(ticketID):
        """Returns tuple of (status_code, description)"""

    def setStatus(ticketID, statusCode):
        """Sets status of ticketID to statusCode"""


class IFullTextSearchTicketSystem(interface.Interface):
    """Ticket systems that allow full text search
    should implement this interface."""

    def search(searchTerms):
        """returns tickets that match the search terms"""


class ISubscribableTicketSystem(interface.Interface):
    """Ticket systems with subscription features
    to automatically route tickets to the appropriate
    people should implement this interface"""

    def listFeeds():
        """lists all ticket feeds."""

    def getTicketsForFeed(feedID):
        """returns tickets in feed"""

    def subscribeToFeed(feedID, callback):
        """Registers a callback to be invoked whenever
        there are new tickets added to this feed"""

